package yxk.task.moka;

import com.alibaba.fastjson.JSONObject;
import kd.bos.context.RequestContext;
import kd.bos.exception.KDException;
import kd.bos.logging.Log;
import kd.bos.logging.LogFactory;
import kd.bos.schedule.executor.AbstractTask;
import kd.sdk.plugin.Plugin;

import java.util.List;
import java.util.Map;

/**
 *  摩卡组织同步
 */
public class MaokaOrgTask extends AbstractTask implements Plugin {
    private static final Log LOG = LogFactory.getLog(MaokaOrgTask.class);
    @Override
    public void execute(RequestContext requestContext, Map<String, Object> map) throws KDException {
        LOG.info("====组织同步已经入=====");
        MoKaService moKaService=new MoKaService();
        List<JSONObject> listOrg = moKaService.getListOrg();
        String moKaToKen = moKaService.getMoKaToKen();
        LOG.info("moKaToKen:{}",moKaToKen);
        if( moKaToKen != null) {
            moKaService.setMoKaOrg(listOrg, moKaToKen);
        }
    }
}